package com.foreknow.service.impl;

import com.foreknow.dao.DepartmentMapper;
import com.foreknow.entity.Department;
import com.foreknow.service.DepartmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DepartmentServiceImpl implements DepartmentService {
    @Autowired
    DepartmentMapper departmentMapper;

    @Override
    public List<Department> queryDeptName() {
        return departmentMapper.queryDeptNameArr();
    }

    @Override
    public int deleteDepById(int id) {
        return departmentMapper.deleteByPrimaryKey(id);
    }

    @Override
    public int insertDep(Department department) {
        return departmentMapper.insert(department);
    }

    @Override
    public int updateDep(Department department) {
        return departmentMapper.updateByPrimaryKeySelective(department);
    }

    @Override
    public List<Department> selectByWhere(Department department) {
        return departmentMapper.selectDep(department);
    }

    @Override
    public Department seletById(int id) {
        return departmentMapper.selectByPrimaryKey(id);
    }
}
